//
//  ThirdTableViewCell.m
//  On The Load
//
//  Created by 许嘉成 on 15/11/14.
//  Copyright © 2015年 @@叶一闽. All rights reserved.
//

#import "ThirdTableViewCell.h"
#import <UIImageView+WebCache.h>
#import "XJCMusciModel.h"

@interface ThirdTableViewCell ()

@property(nonatomic,retain)UIImageView *picImg;
@property(nonatomic,retain)UILabel *nameLabel;
@property(nonatomic,retain)UILabel *infoLabel;

@end

@implementation ThirdTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createCell];
    }
    return self;
}
-(void)createCell
{
    UILabel *titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(10*WIDTH/375, 10*HEIGHT/667, 60*WIDTH/375, 10*HEIGHT/667)];
    titleLabel.text = @"所属频道";
    titleLabel.textColor = [UIColor colorWithWhite:0.702 alpha:1.000];
    titleLabel.font = [UIFont systemFontOfSize:14*SCALEH];
    [self.contentView addSubview:titleLabel];
    
    self.picImg = [[UIImageView alloc]initWithFrame:CGRectMake(titleLabel.frame.origin.x, titleLabel.frame.origin.y+titleLabel.frame.size.height+5, 80*WIDTH/375, 60*HEIGHT/667)];
    [self.contentView addSubview:self.picImg];
    
    self.nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.picImg.frame.origin.x+self.picImg.frame.size.width+5, self.picImg.frame.origin.y, 250*WIDTH/375, 20*HEIGHT/667)];
    self.nameLabel.font = [UIFont systemFontOfSize:17*SCALEH];
    [self.contentView addSubview:self.nameLabel];
    
    self.infoLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.nameLabel.frame.origin.x, self.nameLabel.frame.origin.y+self.nameLabel.frame.size.height + 5, WIDTH-self.nameLabel.frame.origin.x, 40*SCALEH)];
    self.infoLabel.textColor = [UIColor colorWithWhite:0.600 alpha:1.000];
    self.infoLabel.numberOfLines = 0;
    self.infoLabel.font = [UIFont systemFontOfSize:16*SCALEH];
    [self.contentView addSubview:self.infoLabel];
}
-(void)setMusicM:(XJCMusciModel *)musicM
{
    _musicM = musicM;
    self.nameLabel.text = [_musicM.channel objectForKey:@"name"];
    [self.picImg sd_setImageWithURL:[NSURL URLWithString:[_musicM.channel objectForKey:@"pic"]] placeholderImage:[UIImage imageNamed:@"whiteLogo.png"]];
    self.infoLabel.text = [_musicM.channel objectForKey:@"info"];
}

@end
